<%

Function EncodeSql(str)
	Dim str2
	str2 = "" & str
	str2 = Replace(str2 , "'", "''")
	str2 = Replace(str2 , "[", "[[]")
	EncodeSql = str2
End Function


Function EncodeHtml(str)
	Dim str2
	str2 = "" & str
	str2 = Replace(str2 , "<", "&lt;")
	str2 = Replace(str2 , ">", "&gt;")
	str2 = Replace(str2 , """", "&quot;")
	str2 = Replace(str2 , "&", "&amp;")
	EncodeHtml= str2
End Function

Function FormatDateAsCode(DateValue)
	Dim strYYYY
	Dim strMM
	Dim strDD

        strYYYY = CStr(DatePart("yyyy", DateValue))

        strMM = CStr(DatePart("m", DateValue))
        If Len(strMM) = 1 Then strMM = "0" & strMM

        strDD = CStr(DatePart("d", DateValue))
        If Len(strDD) = 1 Then strDD = "0" & strDD

        FormatDateAsCode = strYYYY & strMM & strDD  

End Function 

%>
